module et {
    @SerilizeClass()
    export class Scene extends Entity {
        private _zone: number = 0;
        public get zone() {
            return this._zone;
        }
        private _sceneType: SceneType = SceneType.Process;
        public get sceneType() {
            return this._sceneType;
        }

        private _name: string;

        public get name() {
            return this._name;
        }
        public set name(value: string) {
            this._name = value;
        }
        constructor(id: Long, zone: number, sceneType: SceneType, name: string)
        constructor(id: Long, zone: number, sceneType: SceneType, name: string, instanceId: Long)
        constructor(id: Long, zone: number, sceneType: SceneType, name: string, instanceId?: Long) {
            super();
            this.id = id;
            if (!instanceId)this.instanceId = id;
            this._zone = zone;
            this._sceneType = sceneType;
            this.name = name;
            this.isCreate = true;
            LogUtil.debug(`scene create: ${this.sceneType} ${this.name} ${this.id} ${this.instanceId} ${this.zone}`);
        }
        public dispose(): void {
            super.dispose();
            LogUtil.debug(`scene create: ${this.sceneType} ${this.name} ${this.id} ${this.instanceId} ${this.zone}`);
        }
        public get(id: Long): Scene {
            if (this.children == null) {
                return null;
            }
            let entity = this.children.get(id.toString());
            if (!entity) {
                return null;
            }

            return entity as Scene;
        }
        public get domain(): Entity {
            return this._domain;
        }
        public set domain(value: Entity) {
            this._domain = value;
        }

        public get parent(): Entity {
            return this._parent;
        }
        public set parent(value: Entity) {
            if (value == null) {
                this.parent = this;
                return;
            }
            this._parent = value;
            this._parent.children.set(this.id.toString(), this);
            // if (this.node != null && this._parent.node != null)
            // {
            //     this.node.setParent(this._parent.node);
            // }
        }
    }
}